function plot_beh(mID)

%open database
cn_str = 'PROVIDER=SQLOLEDB; Data Source=PIA1; initial catalog=ExpLog; User ID=explog_user; password=Keller123';
DB = adodb_connect(cn_str, 240);
sql = ['SELECT Stacks.stackid, Stacks.expid, Stacks.comment, Experiments.siteid, Experiments.analysiscode,',...
    'Sites.animalid, Sites.project, Animals.pi FROM Stacks INNER JOIN Experiments ON Stacks.expid=Experiments.expid ' ...
    'INNER JOIN Sites ON Experiments.siteid=Sites.siteid INNER JOIN Animals ON Sites.AnimalID=Animals.AnimalID ORDER BY Stacks.stackid'];
ExpLog = adodb_query(DB, sql);
DB.release;
assignin('base','ExpLog', ExpLog);

%determine ExpIDs for a given (input) mouse
mID=['MH_130724_116']
mouse_ind=find(strcmp(ExpLog.animalid,mID));
[ExpIDs,~]=unique(cell2mat(ExpLog.expid(mouse_ind)),'first');

%read in aux files of mouse ID
for ind = 1:length(ExpIDs)
    fname=['D:\RawData\heinmatt\MH_130724_116\S1-T' num2str(ExpIDs(ind)) '.lvd'];
    t(ind).aux_data=load_lvd(fname);
end

% get running and indices
for knd = 1:length(ExpIDs)
    fname=['D:\RawData\heinmatt\MH_130724_116\S1-T' num2str(ExpIDs(knd)) '.lvd'];
    aux_data=load_lvd(fname);
    [velP,velM,velP_ind,velM_ind,velP_raw,velM_raw]=get_vel_ind_from_adata_M1(aux_data);
    t(knd).velP = -velP;
    clear velP;
    t(knd).velM = -velM;
    clear velM;
    t(knd).velP_ind = velP_ind;
    clear velP_ind;
    t(knd).velM_ind = velM_ind;
    clear velM_ind;
    t(knd).velP_raw = -velP_raw;
    clear velP_raw;
    t(knd).velM_raw = -velM_raw;
    clear velM_raw;
end

%concatenate aux_data angles of experiments of the times when the mouse is
%running

knd = [1 3 5 7 9 11 13 15]

for dnd = 1:length(ExpIDs)/2
    d(dnd).angle=horzcat((t(knd(dnd)).aux_data(10,t(knd(dnd)).velM_ind==1)-2.5)/2.5*180,(t(knd(dnd)+1).aux_data(10,t(knd(dnd)+1).velM_ind==1)-2.5)/2.5*180);    %concatenate aux_angle from 2 regions
end

%count of histogram
for dnd = 1:length(ExpIDs)/2
    [n(dnd,:),~]=hist(d(dnd).angle,100);
end

%ticks
yticks=[0:1/8*(max(max(n,[],2))-mod(max(max(n,[],2)),10000)+10000):max(max(n,[],2))-mod(max(max(n,[],2)),10000)+10000];

%actual histograms
for dnd = 1:length(ExpIDs)/2    % #1,4,8
    figure, hist(d(dnd).angle,100)
    box off
    set(gca,'YLim',[0 max(yticks)]);
    set(gca,'YTick',[yticks],'YTickLabel',[yticks/1000])
    set(gca,'XLim',[-185 185])
    set(gca,'TickDir','out','LineWidth',1,'FontSize',12)
end

%rewards
%read in angular restriction and virtual unit length
M(1).angres=[180 160 100 100 100 100 100 100];
M(2).angres=[180 160 100 100 100 100 100 100];
M(3).angres=[180 160 100 100 100 100 100 100];
M(4).angres=[180 160 100 100 100 100 100 100];
M(5).angres=[180 160 100 100 100 100 100 100];
M(6).angres=[180 160 100 100 100 100 100 100];
M(7).M125.angres=[180 160 100 100 100 100 100 100];
M(1).VU=[25 50 100 200 200 200 200 200];
M(2).VU=[25 50 100 200 200 200 200 200];
M(3).VU=[25 50 100 100 100 200 200 200];
M(4).VU=[25 50 100 100 200 200 200 200];
M(5).VU=[25 50 100 100 200 200 200 200];
M(6).VU=[25 50 100 100 100 200 200 200];
M(7).VU=[25 50 100 100 100 200 200 200];

%determine all Exp & StackIDs
mID=['MH_130724_116';'MH_130724_118';'MH_130724_119';'MH_130724_122';'MH_130724_123';'MH_130724_124';'MH_130724_125']
for xnd = 1:size(mID,1)
    mouse_ind=find(strcmp(ExpLog.animalid,mID(xnd,:)));
    [M(xnd).ExpIDs,~]=unique(cell2mat(ExpLog.expid(mouse_ind)),'first');
    for ynd = 1:length(M(xnd).ExpIDs)
        M(xnd).Exp(ynd).ind=find(M(xnd).ExpIDs(ynd) == cell2mat(ExpLog.expid));
        M(xnd).Exp(ynd).stack=unique(cell2mat(ExpLog.stackid(M(xnd).Exp(ynd).ind)),'first');
    end
end

%read in all aux_data
for xnd = 1:length(M)
    for ind = 1:size(M(xnd).ExpIDs,1)
        for mnd = 1:size(M(xnd).Exp(ind).stackid,1)
            fname=['D:\RawData\heinmatt\' mID(xnd,:) '\S1-T' num2str(M(xnd).Exp(ind).stackid(mnd)) '.lvd'];
            aux_data=load_lvd(fname);
            M(xnd).Exp(ind).stack(mnd).aux = aux_data;
        end
    end
end

for mnd = 1:length(M)
    for dnd = 1:length(M(mnd).ExpIDs)/2
        d(dnd).reward=horzcat(M(mnd).aux_data(11,:),t(knd(dnd)+1).aux_data(11,:));    %concatenate aux_reward from 2 regions
        d(dnd).reward_times=find(diff(round(d(dnd).reward)==5));
        d(dnd).reward_times(diff(d(dnd).reward_times)<20)=[];
        d(dnd).nbr_rewards=length(d(dnd).reward_times);
        d(dnd).rel_rew=d(dnd).nbr_rewards/(length(d(dnd).reward)/60000)*para.;
    end
end




%% manual checks
    d(8).nbr_rewards

    figure, hist(d(6).angle,100)
    figure, hist(d(8).angle,100)
    
    angle_6=horzcat(t(11).aux_data(10,t(11).velM_ind==1),t(12).aux_data(10,t(12).velM_ind==1));    
figure, plot(t(11).aux_data(10,t(11).velM_ind==1))
hold on
plot(t(11).velM*20,'r')
figure, plot(t(12).aux_data(10,t(12).velM_ind==1))